/**
 * 功能描述
 */

define(function (require, exports, module) {
	var DetailGrid = require("grid");
	
    var instance = {
        initComponent: function (params, widget) {
        	var detailgrid = new DetailGrid({
        		parentNode : ".J-detailgrid",
        		autoRender: false,
        		model: {
        			url: "api/roomstatistics/querybytypedetails",
        			 id: "detailgrid",
                     allowEdit: false,
                     columns:[{
                    	 name: "roomCode",
                         label: "房号",
                     },{
                    	 name: "checkinDate",
                         label: "入住日期",
                         format:"date"
                     },{
                    	name: "checkoutDate",
                        label: "退住日期",
                        format:"date"
                     },{
                    	 name: "incoming",
                         label: "收入金额(元)", 
                         format:function(val,row){
                        	 /*var liveDays = parseInt((row.checkoutDate - row.checkinDate)/1000/60/60/24);
                        	 if(liveDays == 0){
                        		 var price = val;
                        	 }else{
                        		 var price = val * liveDays; 
                        	 }
                        	 row.incoming = price;*/
 							 return Number(val).toFixed(2);
 						}
                     }]
        		}
        	});
        	widget.set("detailgrid", detailgrid);
        }
    };
    module.exports = instance;
});
